<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 
<%@ taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
<title>Elective courses 1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="simple.css" />
</head>
<%
	Locale currentLocale= (Locale) request.getSession().getAttribute("currentLocale");
	String userName = "";
	String loginVisibility = "visible";	
	String exitVisibility = "hidden";	
	Cookie cookie = null;
	Cookie cookie1 = null;
	Cookie[] cookies = request.getCookies();
	if (cookies != null) {		
		for (Cookie ck : cookies) {
			if (ck.getName().equals("username")) {
				cookie = ck;
				loginVisibility = "hidden";	
				exitVisibility = "visible";
				userName = cookie.getValue();
			}
			if (ck.getName().equals("password")) {
				cookie1 = ck;
			}
		}
	}
%>

<body>
	<fmt:setLocale value="${currentLocale }" />
	<fmt:bundle basename="fasebandle">

		<h2>
			<fmt:message key="page.title" />
		</h2>
		<hr size="2" />
		<fieldset>
			<div style="visibility: visible;">
				<%=userName%>
			</div>
			<form name="form1" method="post" action="login.perform">
				<div id="loginblock" style="visibility:<%=loginVisibility%>;">
					<table>
						<tr>
							<td><fmt:message key="index.username" />
							<td>
							<td><input type="text" size="30" name="username"></td>
						</tr>
						<tr>
							<td><fmt:message key="index.password" />
							<td>
							<td><input type="password" size="30" name="password"></td>
						</tr>
					</table>

					<p>
						<input type="checkbox" name="save" value="yes">
						<fmt:message key="index.checbox" />
				</div>
				<input type="submit" name="login"
					value=" <fmt:message key="index.button"/> ">
			</form>
		</fieldset>
		<form  name="form2" method="post" action="resetcoockie.perform">
			<div id="exitblock" style="visibility:<%=exitVisibility%>;">
			<input type="submit" name="reset"
				value=" <fmt:message key="index.buttonexit"/> ">
				 
				</div>
		</form>
	</fmt:bundle>
</body>
</html>
